<?php
Class User extends CI_Model
{

	function credentials()
	{
		$this->db->select('user_id, username, upass, fname, lname', 'status');
		$this->db->from('user');
		$this->db->where('username', $this->input->post('username'));
		$this->db->where('upass', md5($this->input->post('password')));

		return $this->db->get()->result();	
	}

	function add_user()
	{
		$user = array(
			'username' => $this->input->post('username'),
			'upass'    => md5($this->input->post('password')),
			'fname'    => $this->input->post('fname'),
			'lname'    => $this->input->post('lname')
			);

		return $this->db->insert('user', $user);
       
	}

	function get_details($id)
	{
		$this->db->select('user_id, username, upass, fname, lname', 'status');
		$this->db->from('user');
		$this->db->where('user_id', $id);

		return $this->db->get()->result_array();	
	}


}